<html>
<head><meta charset="utf-8"><title>Logic panics · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html">Logic panics</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="176736123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176736123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176736123">(Sep 27 2019 at 11:01)</a>:</h4>
<p>Hey, we've seen this assertion trigger in rust-analyzer a number of times: <a href="https://github.com/rust-lang/chalk/blob/df09cc603c0cff9ed95e5554055d483fdd756fbc/chalk-engine/src/logic.rs#L106" target="_blank" title="https://github.com/rust-lang/chalk/blob/df09cc603c0cff9ed95e5554055d483fdd756fbc/chalk-engine/src/logic.rs#L106">https://github.com/rust-lang/chalk/blob/df09cc603c0cff9ed95e5554055d483fdd756fbc/chalk-engine/src/logic.rs#L106</a>, the most recent issue is <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1927" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/1927">https://github.com/rust-analyzer/rust-analyzer/issues/1927</a>.</p>
<p>The failure seems somewhat non-deterministic (it only triggers if invoke compiletion in a particular way). Does this assert means some internal problem in chalk, or are we holding it wrong?</p>



<a name="176758961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176758961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176758961">(Sep 27 2019 at 15:54)</a>:</h4>
<p>hmm</p>



<a name="176758987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176758987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176758987">(Sep 27 2019 at 15:54)</a>:</h4>
<p>mmmmmmmmmm I wonder</p>



<a name="176759001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759001">(Sep 27 2019 at 15:55)</a>:</h4>
<p>it could be perhaps that salsa is panicking</p>



<a name="176759011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759011">(Sep 27 2019 at 15:55)</a>:</h4>
<p>and that chalk is not panic-safe</p>



<a name="176759020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759020">(Sep 27 2019 at 15:55)</a>:</h4>
<p>(I bet that's correct)</p>



<a name="176759041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759041">(Sep 27 2019 at 15:55)</a>:</h4>
<p>e.g., if there were a panic in one of the callbacks that occurred when solving someting</p>



<a name="176759066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759066">(Sep 27 2019 at 15:55)</a>:</h4>
<p>we'd probably leave things in <code>self.stack</code></p>



<a name="176759113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759113">(Sep 27 2019 at 15:56)</a>:</h4>
<p>and then if you call back in, you'll see that error <span class="user-mention" data-user-id="133169">@matklad</span></p>



<a name="176759118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759118">(Sep 27 2019 at 15:56)</a>:</h4>
<p>I can open an issue with some notes on what it would take to fix, probably do-able</p>



<a name="176759891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176759891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176759891">(Sep 27 2019 at 16:04)</a>:</h4>
<p>sounds plausible. When we panic due to cancellation, we advance the revision, which will cause chalk's engine to be re-created (b/c its a volatile query), however there's still a window of opportunity to observe chalk in this revision</p>



<a name="176760275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176760275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176760275">(Sep 27 2019 at 16:09)</a>:</h4>
<p>I've just tried to reproduce this without cancellation, and I see 30 seconds requestsion, but now panics. So, the plausible narrative is that, in this case, chalk takes too long to infer something (which is an unrelated problem). However, because it's slow, it's likely to observe cancellation, which additionally triggers a panic. I think we can easily  do a work-around on our side, by using a mutex with poisoning around the <code>chalk_solve::Solver</code>. We currently use <code>parking_lot::Mutex</code></p>



<a name="176760795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176760795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176760795">(Sep 27 2019 at 16:15)</a>:</h4>
<p>Heh, I am looking into <em>why</em> <code>UnwindSafe</code> didn't caught this issue, and I think that we didn't fix that cyclic  bound problem in salsa, and instread I've just put AssertUnwindSafe around db</p>



<a name="176760947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/176760947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#176760947">(Sep 27 2019 at 16:18)</a>:</h4>
<p>Hello <code>overflow evaluating the requirement db::RootDatabase: ra_hir::db::HirDatabase</code>, my old friend...</p>



<a name="177596972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Logic%20panics/near/177596972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Logic.20panics.html#177596972">(Oct 08 2019 at 09:28)</a>:</h4>
<p>filed <a href="https://github.com/rust-lang/chalk/issues/260" target="_blank" title="https://github.com/rust-lang/chalk/issues/260">https://github.com/rust-lang/chalk/issues/260</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>